package com.wzdigit.wms.raw.service.inv;

import java.math.BigDecimal;
import java.util.List;

import com.wzdigit.wms.basic.domain.dtos.inventory.PrintLabelDto;
import com.wzdigit.wms.basic.mapper.core.transfer.GdnDtlMapper;
import net.dreamlu.mica.core.utils.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wzdigit.wms.basic.client.request.inv.PrintQrCodeRequest;
import com.wzdigit.wms.basic.domain.dtos.inventory.PrintSnDataDto;
import com.wzdigit.wms.basic.service.code.QrCodeParsingService;
import lombok.extern.slf4j.Slf4j;

/**
 * 条码---服务类
 * @author Administrator
 *
 */
@Service
@Slf4j
public class GoodsQrCodeService {

	@Autowired
	private QrCodeParsingService qrCodeParsingService;

	@Autowired
	GdnDtlMapper gdnDtlMapper;
	
	/**
     * 打印二维码
     * 
     * @return
     */
	public List<PrintSnDataDto> printQrCode(PrintQrCodeRequest dto) {
		List<PrintSnDataDto> vo = qrCodeParsingService.generateGoodsLabel(dto.getGoodsIdList());
		return vo;
	}

	public PrintLabelDto getLineAndBatch(BigDecimal headerId, String skuCode) {
		List<PrintLabelDto> list  = gdnDtlMapper.getLineAndBatch(headerId,skuCode);
		if(CollectionUtil.isNotEmpty(list)){
			return  list.get(0);
		}
		return null;
	}
}
